<%@page import="java.util.ArrayList"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
  <%
  	//获取商品数据
  	String book = request.getParameter("book");
  	//将商品保存到购物车中
  	ArrayList<String> cart = (ArrayList)session.getAttribute("cart");
  	if(cart == null){
  		cart = new ArrayList<String>();
  	}	
  	cart.add("book");
  	//将购物车保存到session中
  	session.setAttribute("cart", cart);
  	//返回商品页面
  	response.sendRedirect("book.jsp");
  	
  %>
</body>
</html>